package a_collection.collection.set_demo;

import java.util.HashSet;
import java.util.Set;

/**
 * description:
 * author: xiaoxu
 * createTime: 2018-11-22 15:47
 **/
public class TestSet {

    public static void main(String[] args) {
        Set<String> hashSet = new HashSet<>();
        hashSet.add("hadoop");
        hashSet.add("mapReduce");
        hashSet.add("spark");
        hashSet.add("scala");
        hashSet.add("python");
        int h;
        /*for (String s : hashSet) {
            int hash = (h = s.hashCode()) ^ (h >>> 16);
            System.out.println(s);
            System.out.println(hash%16);
            System.out.println("---------------");
        }*/

        Set<Integer> hashSetInteger = new HashSet<>();
        for (int i = 0; i < 30; i++) {
            if(i%3 == 0){
                continue;
            }
            hashSetInteger.add(i);
        }
        for (Integer s : hashSetInteger) {
            int hash = (h = s.hashCode()) ^ (h >>> 16);
            System.out.println(s);
            System.out.println(hash % 16);
            System.out.println("---------------");
        }


    }
}
